#ifndef _GAME_H
#define _GAME_H
#include "global.h"
#include "CEngine.h"
//Callendar which tells player what day/month it is. Day/month is always set to real day/month,
//Although days pass in the game, it is always the same day. Day and night will cycle, but it is
//always wednesday, for instance. Plants might be bought in town, which can be planted in the
//garden. If the player sleeps for 24 hours, the plant will grow. Alternatively, if the player
//logs in a day later, the plant will grow. They only grow if watered, but don't wilt if not
//watered.
//Master object ID: ID of master object, -1 for none or for items that don't stack. All other items can be stacked
//this way.
//1-6 food per level, 1-3 drink, 15-(20+(abs(level-groundlev)*2)) monsters (from ground level, absolute in either direction.)
//0-4+(level/4) items. Player starts with random weapon, armor, item, food, water. Pills might work like potions.
//Todo: Add MasterAdd function to game. Accepts a named CGroups relevant category and a pointer to an item. Adds
//the item to both the master list and the groups list of items. Clean up monster/item/weapon/object adds.
//Could theme the player's starting equipment, thereby making him appear to start as various strange characters.
class CItem : public CObject
{
	public:
		CItem();
		CItem(char *n,bool e,bool w,bool u,int t,bool f=true,int fa=100);
		~CItem();
		
		virtual void Run();
		virtual void Message(int m);
		
		virtual void Eat();
		virtual void Wear();
		virtual void TakeOff();
		virtual void Use();
		
		virtual CItem *SpawnSelf(int x,int y);
		
		virtual void AI();
		char m_Name[255];
		int m_ItemType,m_WearType;
		bool m_Eat,m_Wear,m_Use;
		bool m_FoodType;
		int m_FoodAmount;
		int m_MasterNum;
		int m_Amount;
};
class CConfidence
{
	public:
		CConfidence() {m_Amount = 0;memset(m_Name,0,255);};
		~CConfidence() {};
		
		int m_Amount;
		char m_Name[255];
};

class CConfidences
{
	public:
		CConfidences();
		~CConfidences();
		
		void AddConfidence(char *c);
		void IncreaseConfidence(char *c,int n);
		int GetConfidence(char *c);
		
		void Clear();
		CList m_Confidences;
};
class CPlayer : public CObject
{
	public:
		CPlayer();
		virtual ~CPlayer();
		
		virtual void Run();
		virtual void Draw();
		virtual void Input(int e);
		virtual void Message(int m);
		
		void DeleteInventory();
		bool AddInvetory(CItem *i);
		void DropInventory(int n);
		void ShowInventory();
		
		void Wear(int n);
		void TakeOff(int n);
		void Eat(int n);
		void Use(int n);
		void ShowWearing();
		void EndGame();
		
		void ShowConfidences();
		void GainLevel();
		
		bool m_Up,m_Down,m_Left,m_Right,m_Wall;
		int m_Health,m_JTime;
		float m_JMap[10];
		bool m_FaceR;
		
		float m_Damage,m_MaxDamage,m_Armor,m_Attack;
		int m_Hunger,m_Thirst,m_MaxHealth;
		int m_HealthRate,m_HealthProgress;
		int m_Experience,m_NextLevel,m_Level;
		char m_Name[255],m_Verb[255];
		CList m_Inventory;
		CList m_Wear;
		CConfidences m_Confidences;
};
class CStairs : public CObject
{
	public:
		CStairs(bool d);
		virtual ~CStairs();
		
		virtual void Message(int m);
		bool m_Up;
};

class CDoor : public CObject
{
	public:
		CDoor(int x,int y);
		
		virtual void Message(int m);
		bool m_Open;
};



class CLaundry : public CItem
{
	public:
		CLaundry();
		~CLaundry();
		virtual void Use();
};

class CArmor : public CItem
{
	public:
		CArmor(char *n,int w,int t,int a);
		~CArmor();
		
		virtual CItem *SpawnSelf(int x,int y);
		
		virtual void Wear();
		virtual void TakeOff();
		float m_Armor;
};

class CWeapon : public CItem
{
	public:
		CWeapon(char *n,int w,int t,int min,int max);
		CWeapon(char *n,int w,int t,int l,float min,float max);
		~CWeapon();
		
		virtual CItem *SpawnSelf(int x,int y);
		
		virtual void Wear();
		virtual void TakeOff();
		int m_Armor;
		float m_MinDamage,m_MaxDamage;
};

class CEnemy : public CObject//Should have seekplayer and opplayer, and useful player related functions.
{
	public:
		CEnemy();
		CEnemy(char *n,char *v,int l,float d,float md,float ar,float a,float mh,float hr,int t);
		virtual ~CEnemy();
		
		virtual void Run();
		virtual void Message(int m);
		
		virtual void AI();
		virtual CEnemy *SpawnSelf(int x,int y);
		void Attack(bool f);
		void Defend();
		void Move(int x,int y,bool f);
		
		float m_Damage,m_MaxDamage,m_Armor,m_Attack,m_Health,m_MaxHealth,m_HealthRate,m_HealthProgress,m_Experience;
		char m_Name[255],m_Verb[255];
		bool m_Started;
};


#endif

